Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash when calling SetConsoleScreenBufferSize in conpty #4021

Merged
merged 2 commits into from
Dec 31, 2019

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

Fixes the bug @DHowett-MSFT found in conpty. Before conpty, this check was all one statement. With the addition of conpty, that statement was moved into a "am I not headless" check, to not restrict the conpty size based on the window size. However, the "is the user trying to resize the buffer smaller than the viewport" should have been done outside the headless check. This just splits that statement up.

PR Checklist

Validation Steps Performed

Ran the tiny repro program Dustin provided - we no longer crash.

@zadjii-msft zadjii-msft added Product-Conpty For console issues specifically related to conpty Severity-Crash Crashes are real bad news. labels Dec 19, 2019
@zadjii-msft zadjii-msft added AutoMerge Marked for automatic merge by the bot when requirements are met Needs-Second It's a PR that needs another sign-off labels Dec 19, 2019
@ghost
Copy link

ghost commented Dec 19, 2019

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 7 hours 15 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the tiny repro program into the tests?

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 19, 2019
@zadjii-msft
Copy link
Member Author

@miniksa So, that's unfortunately not as easy as I'd hope. This crash only repros because when you make the above API call in conpty, the conpty crashes when the renderer thread comes back around to try and paint the frame. With our current tests, it's pretty hard to test the whole stack simultaneously in conpty mode - those unittests are usually focused on one individual piece. What this really needs is the ability to run most of our feature tests within the context of a conpty session, in addition to a normal conhost session. It's the work of #3941 to modify the feature tests to support that.

I suppose I could add that test case to the feature tests now, though it'd always pass, and I don't know if I'd be able to make sure that test would fail in conpty mode... I think it'd be cleaner if we just made sure #3941 also tested this bug.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 20, 2019
Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK fine.

@miniksa miniksa merged commit f6774a7 into master Dec 31, 2019
@miniksa miniksa deleted the dev/migrie/b/3907-conpty-explodes-often branch December 31, 2019 18:29
@ghost
Copy link

ghost commented Jan 14, 2020

🎉Windows Terminal Preview v0.8.10091.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met Needs-Second It's a PR that needs another sign-off Product-Conpty For console issues specifically related to conpty Severity-Crash Crashes are real bad news.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SetConsoleScreenBufferSize(something < viewport) crashes ConPTY host
3 participants